import { keydownCondPairs, using } from '../common.js';
import { picState } from './use-task.js';
import { reasonList } from '../common.js';
import { useJudgeModal } from './use-judge.js';
import { UUID } from '@/util/rnd.js';

const Comment = layerId => ({
  id: UUID(),
  layerId,
  rejectReason: reasonList.value[0],
  remark: '',
  memberOf: 'comments',
});

export function useCommentCore(layerId) {
  picState.value.comments.push(Comment(layerId));
  useJudgeModal({ action: '批注' });
}

export default function useComment() {
  keydownCondPairs.push([event => 'i' == event.key, () => using.value = 'comment']);
}
